<?php
$fileName = $_POST['fileName'];
$thumbnailName = $_POST['thumbNail'];
$exif = exif_read_data($fileName,0,true);
if($exif['GPS']['GPSLatitude'] != ''
	&& $exif['GPS']['GPSLongitude'] != '') {

			$lat = $exif['GPS']['GPSLatitude'];
			list($num, $dec) = explode('/', $lat[0]);
			$lat_s = $num / $dec;
			list($num, $dec) = explode('/', $lat[1]);
			$lat_m = $num / $dec;
			list($num, $dec) = explode('/', $lat[2]);
			$lat_v = $num / $dec;
			$gps_lat = $lat_s + $lat_m / 60.0 + $lat_v / 3600.0;


			$lon = $exif['GPS']['GPSLongitude'];
			list($num, $dec) = explode('/', $lon[0]);
			$lon_s = $num / $dec;
			list($num, $dec) = explode('/', $lon[1]);
			$lon_m = $num / $dec;
			list($num, $dec) = explode('/', $lon[2]);
			$lon_v = $num / $dec;
			$gps_lon = $lon_s + $lon_m / 60.0 + $lon_v / 3600.0;
			$neg = $exif['GPS']['GPSLongitudeRef'];
			if($neg == 'W')
				$gps_lon = "-".$gps_lon;

			$result =  $gps_lat ."=" . $gps_lon ."=" .
			$exif['EXIF']['DateTimeOriginal']."=".$fileName."=".$thumbnailName;
			echo $result;
		}
?>